import {fileURLToPath, URL} from 'node:url'

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
    base: './',
    plugins: [
        vue(),
    ],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        }
    },
    server: {
        host: '0.0.0.0',
        port: 80,
        proxy: {
            '/api': {
                target: 'http://localhost:8081', //本地环境
                // target: 'http://git.xupufen.top',//服务器环境
                changeOrigin: true,
                rewrite: (p) => p.replace(/^\/api/, ""),
            }
        }
    }
})
